<template>
  <el-row :gutter="40" class="panel-group">
    <el-col :xs="24" :sm="24" :lg="6" class="card-panel-col">
      <div class="card-panel" >
        <div class="card-panel-icon-wrapper icon-people card-panel-layout">
          <svg-icon icon-class="index_shop" class-name="card-panel-icon"/>
        </div>
        <div class="card-panel-description">
          <div class="card-panel-text">
            社区数
          </div>
          <div class="card-panel-data">
            <count-to :start-val="0" :end-val="formData.community" :duration="2600" class="card-panel-num"/>
          </div>
        </div>
      </div>
    </el-col>
    <el-col :xs="24" :sm="24" :lg="6" class="card-panel-col">
      <div class="card-panel" >
        <div class="card-panel-icon-wrapper icon-money card-panel-layout">
          <svg-icon icon-class="index_member" class-name="card-panel-icon"/>
        </div>
        <div class="card-panel-description">
          <div class="card-panel-text">
            公司数
          </div>
          <div class="card-panel-data">
            <count-to :start-val="0" :end-val="formData.company" :duration="3200" class="card-panel-num"/>
          </div>
        </div>
      </div>
    </el-col>
    <el-col :xs="24" :sm="24" :lg="6" class="card-panel-col">
      <div class="card-panel" >
        <div class="card-panel-icon-wrapper icon-shopping card-panel-layout">
          <svg-icon icon-class="index_results" class-name="card-panel-icon"/>
        </div>
        <div class="card-panel-description">
          <div class="card-panel-text">
            文章数
          </div>
          <div class="card-panel-data">
            <count-to :start-val="6" :end-val="formData.article" :duration="3600" class="card-panel-num"/>
          </div>
        </div>
      </div>
    </el-col>
    <el-col :xs="24" :sm="24" :lg="6" class="card-panel-col">
      <div class="card-panel" >
        <div class="card-panel-icon-wrapper indexwu card-panel-layout">
          <svg-icon icon-class="index_wu" class="index_wu_xiao" class-name="card-panel-icon"/>
        </div>
        <div class="card-panel-description">
          <div class="card-panel-text" style="font-size:13px">
            守护数
          </div>
          <div class="card-panel-data">
            <count-to :start-val="0" :end-val="formData.People" :duration="3600" class="card-panel-num"/>
          </div>
        </div>
      </div>
    </el-col>
  </el-row>
</template>
<script>
  import CountTo from 'vue-count-to'
  import utils from '../../../../utils/utils.js'
  import { view  } from "@/api/index";
  export default {
    data() {
      return {
        formData:{

        }
      }
    },
    components: {
      CountTo
    },
    created() {
      this.getView()
    },
    methods: {
      delivery(val){
        if (utils.isNull(val)) {
          return 0
        } else {
          return val
        }
      },
      getView() {
        view().then(res => {
          this.formData = res.data
        })
      },
    }
  }
</script>

<style lang="scss" scoped>
  .panel-group {
    .card-panel-col {
      margin-bottom: 32px;
    }

    .card-panel {
      height: 108px;
      cursor: pointer;
      font-size: 12px;
      position: relative;
      overflow: hidden;
      color: #666;
      background: #fff;
      box-shadow: 4px 4px 40px rgba(0, 0, 0, .05);
      border-color: rgba(0, 0, 0, .05);

      &:hover {
        .card-panel-icon-wrapper {
          color: #fff;
        }
        .indexwu{
           background: #008c8c

        }
        .index_wu_xiao{
          color: #fff;
        }

        .icon-people {
          background: #40c9c6;
        }

        .icon-message {
          background: #36a3f7;
        }

        .icon-money {
          background: #f4516c;
        }

        .icon-shopping {
          background: #34bfa3
        }
        .icon-wuxiao {
          background: #f4516c
        }
      }

      .icon-people {
        color: #40c9c6;
      }

      .icon-message {
        color: #36a3f7;
      }

      .icon-money {
        color: #f4516c;
      }

      .icon-shopping {
        color: #34bfa3
      }
       .indexwu{
          color:#008c8c
       }


      .card-panel-icon-wrapper {
        float: left;
        margin: 14px 0 0 14px;
        padding: 16px;
        transition: all 0.38s ease-out;
        border-radius: 6px;
      }

      .card-panel-icon {
        float: left;
        font-size: 48px;
      }

      .card-panel-description {
        float: right;
        font-weight: bold;
        margin: 26px;
        margin-left: 0px;

        .card-panel-text {
          line-height: 18px;
          color: rgba(0, 0, 0, 0.45);
          font-size: 13px;
          margin-bottom: 12px;
          text-align: right;
        }

        .card-panel-num {
          font-size: 15px;
        }
      }
    }
  }

  @media (max-width: 550px) {
    .card-panel-description {
      display: none;
    }

    .card-panel-icon-wrapper {
      float: none !important;
      width: 100%;
      height: 100%;
      margin: 0 !important;

      .svg-icon {
        display: block;
        margin: 14px auto !important;
        float: none !important;
      }
    }
  }

  .card_panel_name {
    font-size: 22px;
    margin-left: 10px;
  }

  .card-panel-layout {
    display: flex;
    justify-content: center;
    align-items: center;
  }

  .card-panel-data {
    display: flex;
    justify-content: flex-end;
  }
</style>
